package com.cuiweiyou.happypaint.util;

import android.view.View;
import android.view.ViewGroup;

public class ViewUtil {
    private ViewUtil() {
    }

    public static void setH(View view, int targetH) {
        ViewGroup.LayoutParams params = view.getLayoutParams();
        params.height = targetH;
        view.setLayoutParams(params);
    }

    public static void setWH(View view, int targetWH) {
        ViewGroup.LayoutParams params = view.getLayoutParams();
        params.width = targetWH;
        params.height = targetWH;
        view.setLayoutParams(params);
    }

    public static int getMinWH(View view){
        int w = view.getMeasuredWidth();
        int h = view.getMeasuredHeight();

        return Math.min(w, h);
    }
}
